<div class="row">
  <div class="panel panel-default">
    <div class="panel-heading panel-title" data-toggle="collapse" data-target="#hooks" >
      Hooks <span class="glyphicon glyphicon-menu-down"></span>
    </div>
    <div id="hooks" class="panel-body collapse">
      <span class="button-bar">
        <%= build_page(cuke_sniffer, "expand_and_collapse_buttons.html.erb") %>
      </span>
      <% if cuke_sniffer.hooks.count == 0 %>
          <div>
            <div>There were no Hooks to sniff in '<%= cuke_sniffer.hooks_location %>'!</div>
          </div>
      <% elsif cuke_sniffer.hooks.count >= 1 && cuke_sniffer.summary[:hooks][:total_score] ==0 %>
          <div>
            <div>Excellent! No smells found for Hooks!</div>
          </div>
      <% else %>
          <% cuke_sniffer.hooks.each do |hook| %>
              <% next if hook.score <= 0 %>
              <div class="hook">
                <div class="row">
                  <div class="title col-md-12">
                    <div class="col-md-1">
                          <span class="red" title="Total score for Hook file.">
                            <%= hook.score %>
                          </span>
                    </div>
                    <div class="col-md-11">
                      <% tags = "(" %>
                      <% hook.tags.each do |tag| %>
                          <% tags << tag %>
                          <% tags << ", " unless tag == hook.tags.last %>
                      <% end %>
                      <% tags += ")" %>
                      <% parameters = "| " %>
                      <% hook.parameters.each do |parameter| %>
                          <% parameters << parameter %>
                          <% parameters << ", " unless parameter == hook.parameters.last %>
                      <% end %>
                      <% parameters += " |" %>
                      <% name = hook.type %>
                      <% name += tags unless tags == "()" %>
                      <% name += " do " %>
                      <% name += parameters unless parameters == "|  |" %>
                      <%= name %>
                    </div>
                  </div>
                  <div class="details col-md-12" style="display:none;">
                    <div class="well">
                      <div class="row">
                        <div class="col-md-12 filename">
                          File:
                          <a target="_blank" href="file:///<%= hook.location.gsub(/:\d+$/, "") %>" title="Note: Links to file on system this report was generated.">
                            <%= hook.location.gsub(cuke_sniffer.hooks_location, '') %>
                          </a>
                        </div>
                        <div class="well col-md-12">
                          <% SummaryHelper::sort_improvement_list(hook.rules_hash).each do |phrase, count| %>
                              <div class="row" data-improvement-row>
                                  <div class="col-md-1 red" data-score>
                                    <%= count %>
                                  </div>
                                  <div class="col-md-11" data-improvement="<%=phrase %>">
                                    <%= phrase %>
                                  </div>
                              </div>
                          <% end %>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
          <% end %>
      <% end %>
    </div>
  </div>
</div>